package cn.dlc.com.account.dao;

import cn.dlc.com.account.entity.Account;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * @author 邓立川
 * @date 2021/1/19 11:33
 * @desc 添加当前类的描述信息
 */
public interface AccountDao extends JpaSpecificationExecutor<Account>, JpaRepository<Account, Long> {

    /**
     * 增加账户余额
     * @param accountNo
     * @param amount
     */
    @Query(value="update tb_account set account_balance = account_balance + ?2 where account_no = ?1",nativeQuery = true)
    @Modifying
    void updateAccount(String accountNo, double amount);
}
